package com.example.springboot.mapper;

import com.example.springboot.JaveBean.Dept;
import com.example.springboot.JaveBean.User;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Auther:Liu
 * @Testname:DeptMapper
 * @Date:2025/4/1 16:02
 */
@Mapper
public interface DeptMapper {
    //查询所有
    @Select("select * from dept")
    List<Dept> selectAllDao();

    //查询一条
    @Select("select * from dept where id=#{id}")
    Dept selectOneDao(Integer id);

    //删除一条数据
    @Delete("delete from dept where id=#{id}")
    void deleteOneDao(Integer id);

    //插入一条数据
    @Insert("insert into dept values (null,#{name},#{createTime},#{updateTime})")
    void insertOneDao(Dept dept);

    @Update("update dept set name=#{name},update_time=#{updateTime} where id=#{id}")
    void updateOneDao(Dept dept);

    @Select("select * from user where username=#{username} and password=#{password}")
    User loginDao(User user);
}
